##################################################################
# /* Author: Gautam Nair and Nicholas Sambanis */
# /* Violence Exposure and Ethnic Identification: Evidence from Kashmir */
# /* Table 1: Study Design */

##################################################################

# change working directory here
# setwd("")

##################################################################
# loading packages
##################################################################
library(Hmisc)
library(foreign)
library(sandwich)
library(lmtest)
library(numDeriv)
library(stargazer)
library(ggplot2)
library(plyr)
library(gridExtra)
library(ri)
library(dplyr)
library(scales)

##################################################################

rm(list=ls())

library(stargazer)

data.working <- read.csv("nei_kashmir_replication_dataset.csv")

groups.temp <- rbind("Control", "Exposure to Violence", "Economic Growth", "Economic Growth + Exposure to Violence", "Integrative Institutions", "Integrative Institutions + Exposure to Violence", "Geographic Priming", "Geographic Priming + Exposure to Violence")
assignment.p <- rbind(0.20, 0.20, 0.10, 0.10, 0.10, 0.10, 0.10, 0.10)

observed.n <- as.data.frame(table(data.working$group_rand1_rand2))[,2]
N <- c(rep(sum(observed.n), 3))
working.table <- as.data.frame(cbind(groups.temp, assignment.p, observed.n))
colnames(working.table) <- c("Group", "Projected Assignment Probability",  "N")
working.table

temptype <- c("latex", "text")
tempext <- c(".tex", ".txt")
table.title <- c("Study Design and Implementation")
output.file <- c("tf_t_01_design")

for(q in 1:length(temptype)){
	temp.output <- paste(output.file, tempext[q], sep="")

	stargazer(working.table, 
	title = table.title,
	out = temp.output,
	type= temptype[q],
	summary=FALSE, 
	rownames=FALSE)
}












